package com.ycy;

import cn.hutool.json.JSONUtil;
import com.alibaba.excel.EasyExcel;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.List;

public class ExcelDemo44 {

//    public static void main(String[] args) {
//
//        String filePath = "C:\\Users\\yincaiyong\\模板20240517a(包括导入及导出模板）\\导入模板\\居住区（村庄）台账导入模板.xlsx";
//
//        GenericDataListener33 listener = new GenericDataListener33();
//        EasyExcel.read(filePath, RaInfoV2ForVillageUploadForCommonUploadExcelByName.class, listener)
//                .headRowNumber(4)
//                .sheet().doRead();
//        System.out.println(JSONUtil.toJsonStr(listener.getDataList()));
//
//    }

    public static final int lastHeadRow = 4;

    public static void main(String[] args) throws FileNotFoundException {

        String filePath = "C:\\Users\\yincaiyong\\模板20240517a(包括导入及导出模板）\\导入模板\\居住区（村庄）台账导入模板.xlsx";

        List<RaInfoV2ForVillageUploadForCommonUploadExcelByNameMulti> list = EasyExcel.read(new FileInputStream(filePath)
                ,new GenericDataListener44())
                .head(RaInfoV2ForVillageUploadForCommonUploadExcelByNameMulti.class)
                .sheet(0).headRowNumber(lastHeadRow)
                .doReadSync();

        System.out.println(JSONUtil.toJsonStr(list));
    }


}
